#ifndef CODEEDITORSETTINGS_H
#define CODEEDITORSETTINGS_H

#include <QtCore/QObject>

namespace CodeEdit {

class BaseTextEditor;
class FontSettings;
struct TabSettings;
struct StorageSettings;
struct BehaviorSettings;
struct DisplaySettings;
struct CompletionSettings;
struct HighlighterSettings;

namespace Internal {
class TextEditorSettingsPrivate;
}

/**
 * This class provides a central place for basic text editor settings. These
 * settings include font settings, tab settings, storage settings, behavior
 * settings, display settings and completion settings.
 */
class CodeEditorSettings : public QObject
{
    Q_OBJECT

public:
    explicit CodeEditorSettings(QObject *parent);
    ~CodeEditorSettings();

    static CodeEditorSettings *instance();

    void initializeEditor(BaseTextEditor *editor);

    const FontSettings &fontSettings() const;
    const TabSettings &tabSettings() const;
    const StorageSettings &storageSettings() const;
    const BehaviorSettings &behaviorSettings() const;
    const DisplaySettings &displaySettings() const;
    const CompletionSettings &completionSettings() const;
    const HighlighterSettings &highlighterSettings() const;

    void setCompletionSettings(const CodeEdit::CompletionSettings &);

signals:
    void fontSettingsChanged(const CodeEdit::FontSettings &);
    void tabSettingsChanged(const CodeEdit::TabSettings &);
    void storageSettingsChanged(const CodeEdit::StorageSettings &);
    void behaviorSettingsChanged(const CodeEdit::BehaviorSettings &);
    void displaySettingsChanged(const CodeEdit::DisplaySettings &);
    void completionSettingsChanged(const CodeEdit::CompletionSettings &);

private:
    Internal::TextEditorSettingsPrivate *_d;
    Q_PRIVATE_SLOT(_d, void fontZoomRequested(int pointSize));
    Q_PRIVATE_SLOT(_d, void zoomResetRequested());

    static CodeEditorSettings *_instance;
};

} // namespace CodeEdit

#endif // CODEEDITORSETTINGS_H
